package 笔试强训;

import java.util.Scanner;

public class _0415T1 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int l = scanner.nextInt();
        int r = scanner.nextInt();
        int res = 0;
        int tmp = 0;
        while(l<=r) {
            tmp = l;
            while(tmp!=0) {
                if(tmp%10==2) {
                    res++;
                }
                tmp/=10;
            }
            l++;
        }
        System.out.println(res);
    }

}